// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: leon

#pragma once

#include <iomanip>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#include "coin2/base/time.h"
#include "coin2/exchange/feed.pb.h"

struct FundingRate {
  int64_t timestamp;
  double funding_rate;
  int64_t funding_time;
  double estimated_rate;

  void Clear() {
    timestamp = 0;
    funding_rate = 0;
    funding_time = 0;
    estimated_rate = 0;
  }
};

inline std::ostream& operator<<(
    std::ostream& os,
    const FundingRate& funding_rate) {
  os << "Funding Rate ";
  os << "(funding_rate=";
  os << std::setw(15);
  os << funding_rate.funding_rate;
  os << ",funding_time=";
  os << std::setw(15);
  os << funding_rate.funding_time;
  os << ",estimated_rate=";
  os << std::setw(15);
  os << funding_rate.estimated_rate;
  os << ")";
  return os;
}
